Set Levels Based on Object Heading Contents

I am fairly new to DXL so I'm not really sure where to begin with a script to acheive what I need to do. I have a module that was created by importing a large excel spreadsheet. Each object in the module has its own heading beginning with its paragraph number (i.e. 1 1.1 1.1.1 1.1.2 etc). I want to create a DXL script that looks at the heading of each object, determines the number of integers present, and based on that number, assigns it to the appropriate level. For example, if the object heading is 3.2, it would assign it to level 2, while 3.2.1 would be level 3, 3.2.1.1 would be 4 and so on. Is this even possible, and if so what would be the most efficient way to implement this script? Thanks for any help!
jalegg625 - Wed Jun 13 13:23:57 EDT 2012

Re: Set Levels Based on Object Heading Contents
David_G_Bond - Wed Jun 13 14:47:11 EDT 2012

The easiest way I can think of is to count the number of periods in the heading number and add 1 to get the level number.

David Bond

Re: Set Levels Based on Object Heading Contents
llandale - Wed Jun 13 16:48:04 EDT 2012

Yes could periods to determine the desired level.

But you cannot assign an object a specific "level". You can only "move" an object either after or below some other object. That positioning determines the object's level. Object that you want to be "3.2.1" will need to be moved "below" object "3.2", and object "3.2.1" will need to be moved "after" object "3.2.1".

That gets real sticky; someone wrote a program for that but I don't recall where.

-Louie

Re: Set Levels Based on Object Heading Contents
SystemAdmin - Wed Jun 13 18:57:43 EDT 2012

Louie is correct - someone did have a crack at a DXL script to do this. Michael Sutherland's Build Hierarchy script is the one to look at - go to this website http://www.galactic-solutions.com/GalacticDownloads.htm.

It's dated 2003 when DOORS version 7.1 was king, but a simple test indicates it seems to run OK. Read the "Known Issues" comment just below the version history as this provides some rules about the allowed syntax for the paragraph number string.

Prepare to experiment to get your paragraph numbers right, if you haven't done so already you may have to modify the import spreadsheet so that paragraphs that are headings are separated into a column that will be mapped to the "Object Heading" attribute, and the rest to the "Object Text" attribute.

Good Luck.


Paul Miller
Melbourne, Australia